<?php
// +----------------------------------------------------------------------
// | Categories(日志分类
// +----------------------------------------------------------------------
// | @link ( http://www.yurnero.net )
// +----------------------------------------------------------------------
// | @copyright
// +----------------------------------------------------------------------
// | @licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | @author Haijun Wu <nicholasinlove@126.com>
// +----------------------------------------------------------------------
// | $Id: ArchivesWidget.class.php 74 2011-03-29 15:37:24Z nicholasinlove1986@gmail.com $
// +----------------------------------------------------------------------


class CategoriesWidget extends Widget {

	/**
	 * 构造日志分类
	 * 
	 */
	public function render($data) {
	
		$cat =  f_static_cache('category_isshow_static','',ROOT_PATH . STATIC_CACHES_DIR);
	    $output = '';
		$output .= '<!-- Categories: START -->'."\n";
		$output .= " <li class=\"widget widget_categories dbx-box\">\n";
		$output .= "  <h3 class=\"dbx-handle\">Categories</h3>\n";
		$output .= "   <ul class='dbx-content'>\n";
		foreach ($cat as $v) {
			$output .= "    <li class=\"cat-item cat-item-".$v['category_id']."\" style=\"margin-left:".$v['level']."em\">";
			$output	.= '<a href='.__APP__.'/Category/'.$v['category_url'].'/ title="View all posts filed under '.$v['category_title'].'">'.$v['category_title'].'</a>&nbsp;&nbsp;['.$v['posts_num'].']';
			$output .= "</li>\n";
		}
		$output .= "   </ul>\n";
		$output .= " </li>\n";
		$output .= ' <!-- Categories: END -->'."\n";
		return $output;
	}
		
}

?>
